<?
require_once("../config/dbconn.php");require_once("../config/powercls.php");
if ($act=='chkusername'){
	$return=0;
	$sqlc="select id from {$db_prefix}users where username='$username'";
	$rsc=$db->get_one($sqlc);
	if ($rsc['id']) $return=0;else $return=1;
	echo "send_success:".$return;
}
if ($act=='chktjuser'){
	$return=0;
	$sqlc="select id from {$db_prefix}users where username='$tjuser'";
	$rsc=$db->get_one($sqlc);
	if ($rsc['id']) $return=1;else $return=0;
	echo "send_success:".$return;
}
if ($act=='chkgluser'){
	$return=0;
	$sqlc="select id from {$db_prefix}users where username='$gluser'";
	$rsc=$db->get_one($sqlc);
	if ($rsc['id']){
		$return=1;
		if ($pos){
			$sqlp="select id from {$db_prefix}users where gluser='$gluser' and pos='$pos'";
			$rsp=$db->get_one($sqlp);
			if (!$rsp['id']) $return=2;else $return=3;
		}
	}
	echo "send_success:".$return;
}
if ($act=='chkpos'){
	$return=0;
	$sqlc="select id from {$db_prefix}users where username='$gluser'";
	$rsc=$db->get_one($sqlc);
	if ($rsc['id']){
		$sqlp="select id from {$db_prefix}users where gluser='$gluser' and pos='$pos'";
		$rsp=$db->get_one($sqlp);
		if (!$rsp['id']) $return=1;else $return=2;
	}
	echo "send_success:".$return;
}
if ($act=='chkbduser'){
	$return=0;
	$sqlc="select id from {$db_prefix}users where username='$bduser' and isdp=1";
	$rsc=$db->get_one($sqlc);
	if ($rsc['id']) $return=1;
	echo "send_success:".$return;
}
//推荐网体的时候需要显示的内容
if ($act=='chkusernametj'){
	$return=0;$returnstr='';
	$sqlc="select * from {$db_prefix}users where username='$username'";
	$rsc=$db->get_one($sqlc);
	if ($rsc['id']){
		$return=1;
		$returnstr="姓名：{$rsc['nickname']}。推荐编号：{$rsc['tjuser']}";
	}else{
		$return=0;
		$returnstr="用户编号不存在";
	}
	echo "send_success:".$return.":".$returnstr;
}
//推荐网体的时候需要显示的内容
if ($act=='chktjuserxg'){
	$return=0;$returnstr='';
	$sqlc="select * from {$db_prefix}users where username='$tjuser'";
	$rsc=$db->get_one($sqlc);
	if ($rsc['id']){
		$return=1;
		$returnstr="姓名：{$rsc['nickname']}。";
	}else{
		$return=0;
		$returnstr="推荐人编号不存在";
	}
	echo "send_success:".$return.":".$returnstr;
}
?>